package soccerscope.training;

import soccerscope.model.PlayMode;

// This class represents the counter for one Condition in the Statistics
public class TrainingStatsElement {

  private int    counter;

  private int    index;

  private String name;

  public TrainingStatsElement(
      int n) {

    super();
    this.index = n;
    // at the beginning, no conditons are counted, so start with 0
    this.counter = 0;
    this.setName(this.index);
  }

  public void inc() {

    this.counter++;
  }

  public int getIndex() {

    return this.index;
  }

  public int getCounter() {

    return this.counter;
  }

  public String getName() {

    return this.name;
  }

  @Override
  public String toString() {

    return this.name + "(" + this.counter + ")";
  }

  // _____________________________________________________________
  // HELP METHODS
  // _____________________________________________________________

  private void setName(int index) {

    if (index == 0) {
      this.name = "TrainingRuns";
    }
    if (index == 1) {
      this.name = "CycleCondition";
    }
    if (index == 2) {
      this.name = "BallPossessionCondition";
    }
    if (index > 2) {
      this.name = PlayMode.toString(index - 3);
    }
    if (index < 0) {
      this.name = "";
    }
  }
}